﻿using System;
using System.Collections.Generic;
using SlamCms.Data;

namespace SlamCmsDemo.Web.Core.Models
{
	public class ContentItemDetailsViewModel
	{
		public ContentItem BaseContentItem { get; set; }
		public IEnumerable<Tag> TypeTags { get; set; }
		public IEnumerable<Tag> TopicTags { get; set; }
		public IEnumerable<Tag> LocationTags { get; set; }
		public ContentList RelatedContent { get; set; }
		public ContentList RelatedFaqs { get; set; }

		public static ContentItemDetailsViewModel Create(ContentItem contentItem)
		{
			return (ContentItemDetailsViewModel)Activator.CreateInstance(typeof(ContentItemDetailsViewModel<>).MakeGenericType(contentItem.GetType()), contentItem);
		}
	}

	public class ContentItemDetailsViewModel<T> : ContentItemDetailsViewModel where T : ContentItem
	{
		public ContentItemDetailsViewModel(T contentItem)
		{
			ContentItem = contentItem;
			BaseContentItem = contentItem;
		}

		public T ContentItem { get; set; }
	}
}